/**
*******************************************************************************
* @file                  zynq_gpio.h
* @author                $Author: Xu <> $
*
* Base class for devices connected via SPI.
* Copyright 2016 RobSense. All rights reserved.
*******************************************************************************/
#ifndef _UARTDRIVER_
#define _UARTDRIVER_

#ifdef __cplusplus
extern "C" {
#endif
/***************************** Include Files *********************************/
#include "stdio.h"
#include "stdbool.h"
#include "stdint.h"
/************************** Constant Definitions *****************************/

/************************** Variable Definitions ******************************/
typedef struct {
	void (*begin)(int32_t ch, uint32_t baud, uint16_t rxSpace, uint16_t txSpace);
	void (*end)(int32_t ch);
	void (*flush)(int32_t ch);
	bool (*is_initialized)(int32_t ch);
    void (*set_blocking_writes)(int32_t ch, bool blocking);
    bool (*tx_pending)(int32_t ch);
    uint32_t (*available)(int32_t ch);
    uint32_t (*txspace)(int32_t ch);
    int16_t (*read)(int32_t ch);
    size_t (*write_byte)(int32_t ch, uint8_t c);
    size_t (*write)(int32_t ch, uint8_t *buffer, size_t size);
    void (*timer_tick)(void);
}UARTDriver_t;
/************************** Function Prototypes ******************************/
/* Linux implementations of UARTDriver virtual methods */
void UARTDriver_constructs(UARTDriver_t *instance);

#ifdef __cplusplus
}
#endif
#endif
